package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.bean.AddressBook;
import com.itheima.dao.AddressBookDao;
import com.itheima.service.AddressBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Tang
 * @date 2023/2/25
 */
@Service
public class AddressBookServiceImpl extends ServiceImpl<AddressBookDao, AddressBook> implements AddressBookService {
    @Autowired
    private AddressBookService addressBookService;

    /*
    @Override
    public void update(AddressBook addressBook) {
        addressBookService.updateById(addressBook);
    }*/

    /**
     * 删除地址
     * @param addressId
     */
    @Override
    public void deleteAddress(Long addressId) {
        //1.设置条件构造器
        LambdaQueryWrapper<AddressBook> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(AddressBook::getId, addressId);
        //2.调用service的删除方法
        addressBookService.removeById(addressId);

    }
}
